﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="../assets/css/yui-cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="shortcut icon" type="image/x-icon" href="../assets/favicon.ico">
    <script src="../assets/js/yui-source.js"></script>
	<title>TweenJS v1.0.0 API Documentation : CSSPlugin</title>
</head>
<body class="yui3-skin-sam">

<div id="doc">
    <div id="hd" class="yui3-g header">
        <div class="yui3-u-3-4">
            
                <h1><a href="http://createjs.site/tweenjs"><img src="../assets/docs-icon-TweenJS.png" title="TweenJS"></a></h1>
            
        </div>
        <div class="yui3-u-1-4 version">
            <em>API Documentation for: 1.0.0</em>
        </div>
    </div>
    <div id="bd" class="yui3-g">

        <div class="yui3-u-1-4">
            <div id="docs-sidebar" class="sidebar apidocs">
                <div id="api-list">
    <h2 class="off-left">APIs</h2>
    <div id="api-tabview" class="tabview">
        <ul class="tabs">
            <li><a href="#api-classes">Classes</a></li>
        </ul>

        <div id="api-tabview-filter">
            <input type="search" id="api-filter" placeholder="Type to filter APIs">
        </div>

        <div id="api-tabview-panel">
            <ul id="api-classes" class="apis classes">
            
                <li><a href="AbstractTween.html">AbstractTween</a></li>
            
                <li><a href="ColorPlugin.html">ColorPlugin</a></li>
            
                <li><a href="CSSPlugin.html">CSSPlugin</a></li>
            
                <li><a href="Ease.html">Ease</a></li>
            
                <li><a href="Event.html">Event</a></li>
            
                <li><a href="EventDispatcher.html">EventDispatcher</a></li>
            
                <li><a href="MotionGuidePlugin.html">MotionGuidePlugin</a></li>
            
                <li><a href="RelativePlugin.html">RelativePlugin</a></li>
            
                <li><a href="RotationPlugin.html">RotationPlugin</a></li>
            
                <li><a href="SamplePlugin.html">SamplePlugin</a></li>
            
                <li><a href="Ticker.html">Ticker</a></li>
            
                <li><a href="Timeline.html">Timeline</a></li>
            
                <li><a href="Tween.html">Tween</a></li>
            
                <li><a href="TweenJS.html">TweenJS</a></li>
            
                <li><a href="Utility%20Methods.html">Utility Methods</a></li>
            
            </ul>

            <ul id="api-modules" class="apis modules">
            
                <li><a href="../modules/CreateJS.html">CreateJS</a></li>
            
                <li><a href="../modules/EaselJS.html">EaselJS</a></li>
            
                <li><a href="../modules/TweenJS.html">TweenJS</a></li>
            
            </ul>
        </div>
    </div>
</div>

            </div>
        </div>
        <div class="yui3-u-3-4">
            <div id="api-options">
        Show:
        <label for="api-show-inherited">
            <input type="checkbox" id="api-show-inherited" checked="">
            Inherited
        </label>

        <label for="api-show-protected">
            <input type="checkbox" id="api-show-protected">
            Protected
        </label>

        <label for="api-show-private">
            <input type="checkbox" id="api-show-private">
            Private
        </label>
        <label for="api-show-deprecated">
            <input type="checkbox" id="api-show-deprecated">
            Deprecated
        </label>

    </div>
            <div class="apidocs">
                <div id="docs-main">
                    <div class="content">
                        <h1>CSSPlugin Class</h1>
<div class="box meta">
    

    

    
        <div class="foundat">
            Defined in: <a href="../files/tweenjs_plugins_CSSPlugin.js.html#l38"><code>CSSPlugin:38</code></a>
        </div>
    

    
        
            Module: <a href="../modules/TweenJS.html">TweenJS</a>
        
    

    
</div>



<div class="box intro">
    <p>A TweenJS plugin for working with numeric CSS string properties (ex. top, left). To use simply install after
TweenJS has loaded:</p>
<pre class="code prettyprint"><code>createjs.CSSPlugin.install();</code></pre>
<p>CSSPlugin works with almost any style property or unit. It identifies CSS values by looking for an initial value
on the element&#39;s <code>style</code> object. It also uses this initial value to parse out the units to use with that value.</p>
<p>In the following example, <code>top</code> would be tweened as a style using <code>em</code> units using CSSPlugin, but <code>width</code> 
would be not be tweened as a style (because there is no initial inline style value for it).</p>
<pre class="code prettyprint"><code>myEl.style.top = "10em";
createjs.Tween.get(myEl).to({top:20, width:100}, 1000);</code></pre>
<p>CSSPlugin can also use computed styles. Please see AbstractTween/compute:property
for more information.</p>
<p>CSSPlugin has specific handling for the <code>transform</code> style, and will tween any transforms as long as their operations
and units match. For example:</p>
<pre class="code prettyprint"><code>myEl.style.transform = "translate(20px, 30px)";
createjs.Tween.get(myEl)
    .to({transform: "translate(40px, 50px)"}, 900) // would be tweened, everything matches
    .to({transform: "translate(5em, 300px)"}, 900) // would NOT be tweened, different units (px vs em)
    .to({transform: "scaleX(2)"}, 900) // would NOT be tweened, different operations (translate vs rotate)</code></pre>
<p>You can also use <code>*</code> to copy the operation at that position from the previous transform.</p>
<pre class="code prettyprint"><code>myEl.style.transform = "translate(0px, 0px) rotate(0deg)";
createjs.Tween.get(myEl)
    .to({transform: "translate(50px, 50px) *"}, 900) // would copy the "rotate" operation
    .to({transform: "* rotate(90deg)"}, 900) // would copy the "translate" operation</code></pre>
<p>Please note that the CSS Plugin is not included in the TweenJS minified file.</p>

</div>


    <div class="constructor">
        <h2>Constructor</h2>
        <div id="method_CSSPlugin" class="method item">
    <h3 class="name"><code>CSSPlugin</code></h3>

    
        <span class="paren">()</span>
    

    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/tweenjs_plugins_CSSPlugin.js.html#l38"><code>CSSPlugin:38</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        
    </div>

    

    

    
</div>

    </div>


<div id="classdocs" class="tabview">
    <ul class="api-class-tabs">
        <li class="api-class-tab index"><a href="#index">Index</a></li>

        
            <li class="api-class-tab methods"><a href="#methods">Methods</a></li>
        
        
            <li class="api-class-tab properties"><a href="#properties">Properties</a></li>
        
        
        
    </ul>

    <div>
        <div id="index" class="api-class-tabpanel index">
            <h2 class="off-left">Item Index</h2>

            
                <div class="index-section methods">
                    <h3>Methods</h3>

                    <ul class="index-list methods">
                        
                            <li class="index-item method">
                                <a href="#method_change">change</a>

                                
                                    <span class="flag static">static</span>
                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_init">init</a>

                                
                                    <span class="flag static">static</span>
                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_install">install</a>

                                
                                    <span class="flag static">static</span>
                                
                                
                            </li>
                        
                            <li class="index-item method">
                                <a href="#method_step">step</a>

                                
                                    <span class="flag static">static</span>
                                
                                
                            </li>
                        
                    </ul>
                </div>
            

            
                <div class="index-section properties">
                    <h3>Properties</h3>

                    <ul class="index-list properties">
                        
                            <li class="index-item property">
                                <a href="#property_compute">compute</a>

                                
                                    <span class="flag static">static</span>
                                
                                
                            </li>
                        
                            <li class="index-item property">
                                <a href="#property_ID">ID</a>

                                
                                    <span class="flag static">static</span>
                                
                                
                            </li>
                        
                            <li class="index-item property protected">
                                <a href="#property_priority">priority</a>

                                
                                    <span class="flag static">static</span>
                                
                                
                            </li>
                        
                            <li class="index-item property">
                                <a href="#property_VALUE_RE">VALUE_RE</a>

                                
                                    <span class="flag static">static</span>
                                
                                
                            </li>
                        
                    </ul>
                </div>
            

            

            
        </div>

        
            <div id="methods" class="api-class-tabpanel">
                <h2 class="off-left">Methods</h2>

                
                    <div id="method_change" class="method item">
    <h3 class="name"><code>change</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>tween</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>step</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>prop</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>value</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>ratio</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>end</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type">Any</span>
        </span>
    

    

    

    

    
        <span class="flag static">static</span>
    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/tweenjs_plugins_CSSPlugin.js.html#l202"><code>change:202</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Called before a property is updated by the tween.
See <a href="SamplePlugin.html#method_change" class="crosslink">change</a> for more info.</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">tween</code>
                        <span class="type"><a href="Tween.html" class="crosslink">Tween</a></span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">step</code>
                        <span class="type">TweenStep</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">prop</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">value</code>
                        <span class="type">Any</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">ratio</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number" class="crosslink external" target="_blank">Number</a></span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">end</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Any</span>:
                    
                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_init" class="method item">
    <h3 class="name"><code>init</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>tween</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>prop</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>value</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type">Any</span>
        </span>
    

    

    

    

    
        <span class="flag static">static</span>
    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/tweenjs_plugins_CSSPlugin.js.html#l152"><code>init:152</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Called by TweenJS when a new property initializes on a tween.
See <a href="SamplePlugin.html#method_init" class="crosslink">init</a> for more info.</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">tween</code>
                        <span class="type"><a href="Tween.html" class="crosslink">Tween</a></span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">prop</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">value</code>
                        <span class="type">Any</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type">Any</span>:
                    
                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_install" class="method item">
    <h3 class="name"><code>install</code></h3>

    
        <span class="paren">()</span>
    

    

    

    

    

    
        <span class="flag static">static</span>
    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/tweenjs_plugins_CSSPlugin.js.html#l143"><code>install:143</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Installs this plugin for use with TweenJS. Call this once after TweenJS is loaded to enable this plugin.</p>

    </div>

    

    

    
</div>

                
                    <div id="method_step" class="method item">
    <h3 class="name"><code>step</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>tween</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>step</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>props</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    
        <span class="flag static">static</span>
    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/tweenjs_plugins_CSSPlugin.js.html#l187"><code>step:187</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Called when a new step is added to a tween (ie. a new "to" action is added to a tween).
See <a href="SamplePlugin.html#method_step" class="crosslink">step</a> for more info.</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">tween</code>
                        <span class="type"><a href="Tween.html" class="crosslink">Tween</a></span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">step</code>
                        <span class="type">TweenStep</span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">props</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
                    

                    

                    <div class="param-description">
                         
                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    

    
</div>

                
            </div>
        

        
            <div id="properties" class="api-class-tabpanel">
                <h2 class="off-left">Properties</h2>

                
                    <div id="property_compute" class="property item">
    <h3 class="name"><code>compute</code></h3>
    <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>

    

    

    

    
        <span class="flag static">static</span>
    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/tweenjs_plugins_CSSPlugin.js.html#l113"><code>compute:113</code></a>
        
        </p>

        

        
    </div>

    <div class="description">
        <p>By default, CSSPlugin uses only inline styles on the target element (ie. set via the style attribute, <code>style</code> property, or <code>cssText</code>)
to determine which properties should be tweened via CSS, and what units to use.</p>
<p>Setting <code>compute</code> to <code>true</code> causes CSSPlugin to use <code>getComputedStyle</code> for this purpose. This has the advantage of
including all styles that effect the target element, however there are some important considerations for its use:<ul>
    <li> <code>getComputedStyle</code> is computationally expensive, which could lead to performance issues if you are creating a large
    number of tweens at once.
    <li> styles are normalized. For example, a width value specified as a <code>%</code> may be computed as <code>px</code>, which CSSPlugin will
    use for the tween. Different browsers <em>may</em> normalize values differently.
    <li> there are a large number of computed styles, which increases the chance that a property will be identified as a style.
    <li> does not work with IE8 or below.
    </li></ul>
<pre class="code prettyprint"><code>The <code>compute</code> setting can be overridden on a per-tween basis by setting <code>tween.pluginData.CSS_compute</code>. For example,
to enable computed styles for a new tween, you could use:

    createjs.Tween.get(el, {pluginData:{CSS_compute:true}}).to({top:20}, 1000);

Given the considerations for <code>compute</code>, it is recommended that you keep the default global setting of <code>false</code> and override it
in specific cases via <code>pluginData</code>.</code></pre>

    </div>

    
        <p><strong>Default:</strong> false</p>
    

    

    
</div>

                
                    <div id="property_ID" class="property item">
    <h3 class="name"><code>ID</code></h3>
    <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>

    

    

    

    
        <span class="flag static">static</span>
    

    
        <span class="flag readonly">readonly</span>
    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/tweenjs_plugins_CSSPlugin.js.html#l89"><code>ID:89</code></a>
        
        </p>

        

        
    </div>

    <div class="description">
        <p>READ-ONLY. A unique identifying string for this plugin. Used by TweenJS to ensure duplicate plugins are not installed on a tween.</p>

    </div>

    

    

    
</div>

                
                    <div id="property_priority" class="property item protected">
    <h3 class="name"><code>priority</code></h3>
    <span class="type">Unknown</span>

    

    
        <span class="flag protected">protected</span>
    

    

    
        <span class="flag static">static</span>
    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/tweenjs_plugins_CSSPlugin.js.html#l82"><code>priority:82</code></a>
        
        </p>

        

        
    </div>

    <div class="description">
        
    </div>

    

    

    
</div>

                
                    <div id="property_VALUE_RE" class="property item">
    <h3 class="name"><code>VALUE_RE</code></h3>
    <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/RegExp" class="crosslink external" target="_blank">RegExp</a></span>

    

    

    

    
        <span class="flag static">static</span>
    

    
        <span class="flag readonly">readonly</span>
    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/tweenjs_plugins_CSSPlugin.js.html#l98"><code>VALUE_RE:98</code></a>
        
        </p>

        

        
    </div>

    <div class="description">
        <p>READ-ONLY.</p>

    </div>

    

    

    
</div>

                
            </div>
        

        

        
    </div>
</div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
